package com.colin.util.interceptor;

import com.colin.log.mvc.MvcLogInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration
public class MvcInterceptor extends WebMvcConfigurationSupport {

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        // 1、对 http 请求生成 traceId 以及获取请求 IP
        registry.addInterceptor(new MvcLogInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }

}
